/**
 *
 */
package coms6111.astbbw.dataminer;

import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileNotFoundException;

/**
 * @author ben
 *
 */
public class MineDumper {

	/**
	 * Build a precomputed index for either dataset.
	 * @param args dataset, outputfile (should end with ".txt")
	 */
	public static void main(String[] args) {
		org.apache.log4j.BasicConfigurator.configure();
		Logger l = Logger.getLogger(MineDumper.class);
		String dataset = args[0].toLowerCase();
		File outputFile = new File(args[1]);
		DataMine mine = new GlimpseBitIndexed(dataset);

		l.info("Building index for dataset " + dataset);
		mine.buildIndex();
		l.info("Dumping index to file " + outputFile.getPath());
		try {
			mine.dumpIndex(outputFile);
		} catch (FileNotFoundException e) {
			l.fatal("File not found",e);
		}
		mine.destroy();
	}

}
